<?php

namespace app\common\order\validate;

use think\Validate;

class OrderVipValidate extends Validate
{

    protected $rule = [
      "name" => "require",
        "id_card" => [
            "require",
            "regex" => "/(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/"
        ],
        "phone" => [
            "require",
            "regex" => "/^1[3456789]\d{9}$/"
        ],
        "event_date" => "require",
        "hospital" => "require",
        "address" => "require",
        "urgent_name" => "require",
        "urgent_phone" => [
            "require",
            "regex" => "/^1[3456789]\d{9}$/"
        ],
        "urgent_relation" => "require"
    ];

    protected $message = [
        "name.require" => "贵宾姓名不能为空",
        "id_card.require" => "身份证号不能为空",
        "id_card.regex" => "身份证号格式错误",
        "phone.require" => "手机号不能为空",
        "phone.regex" => "手机号格式错误",
        "event_date.require" => "预产期日期不能为空",
        "hospital.require" => "就诊医院不能为空",
        "address.require" => "家庭地址不能为空",
        "urgent_name.require" => "紧急联系人姓名不能为空",
        "urgent_phone.require" => "紧急联系人手机号不能为空",
        "urgent_phone.regex" => "紧急联系人手机号格式错误",
        "urgent_relation.require" => "紧急联系人关系不能为空"
    ];


    protected $scene = [
        // 月子中心
        "hotel" => [
            "name",
            "id_card",
            "phone",
            "event_date",
            "hospital",
            "address",
            "urgent_name",
            "urgent_phone",
            "urgent_relation"
        ],
        // 服务
        "service" => [
            "name",
            "phone",
        ]
    ];

}